<header class="navbar navbar-fixed-top navbar-inverse">
  <div class="container">
    <%= link_to "机械工程材料教学网", root_path, id: "logo" %>

    <nav>
      <ul class="nav navbar-nav ">
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            学习资源 <b class="caret"></b>
          </a>
          <ul class="dropdown-menu">
            <li><%= link_to "在线视频", videos_path %></li>
            <li><%= link_to "学科介绍", about_path %></li>
            <li class="divider"></li>
            <li>
              <%= link_to "课件下载",'http://localhost:3000' %>
              <%= link_to "金相图谱", help_path %>
            </li>
          </ul>
        </li>
        <li><%= link_to "在线考试", exams_path %></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            工程材料习题 <b class="caret"></b>
          </a>
          <ul class="dropdown-menu">
            <li><%= link_to "习题一", paper1_path %></li>
            <li><%= link_to "习题二", paper2_path %></li>
            <li><%= link_to "习题三", paper3_path %></li>
            <li><%= link_to "习题四", paper4_path %></li>
            <li><%= link_to "习题五", paper5_path %></li>
          </ul>
        </li>
        <li><%= link_to "机械社区", homeland_path %></li>
        <li><%= link_to "联系我们", contact_path %></li>
      </ul>

      <ul class="nav navbar-nav nav-right">
        <% if logged_in? %>
            <% if current_user.admin? %>

                <li><%= link_to '', admin_index_path, class: 'fa fa-tasks fa-fw'%></li>
            <% end %>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
              </a>
              <ul class="dropdown-menu">
                <li><%= link_to '写微博', current_user , class: 'fa fa-user-circle'%></li>
                <li><%= link_to "设置", edit_user_path(current_user), class: 'fa fa-gear fa-fw' %></li>
                <li class="divider"></li>
                <li>
                  <%= link_to "注销", logout_path, method: "delete", class: 'fa fa-sign-out fa-fw' %>
                </li>
              </ul>
            </li>
        <% else %>
            <li><%= link_to "登录", login_path %></li>
        <% end %>
      </ul>
    </nav>
  </div>
</header>